package com.ytjj.qmyx.admin.service.impl;

import com.github.pagehelper.PageHelper;
import com.ytjj.common.api.CommonPage;
import com.ytjj.common.exception.ApiException;
import com.ytjj.qmyx.admin.dao.HotCategoryProductDao;
import com.ytjj.qmyx.admin.model.request.HotCategoryProductRequest;
import com.ytjj.qmyx.admin.model.response.HotCategoryProductResponse;
import com.ytjj.qmyx.admin.service.HotCategoryProductService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 *
 *
 * @Version: 1.0
 */
@Service
public class HotCategoryProductServiceImpl implements HotCategoryProductService {

    @Resource
    private HotCategoryProductDao hotCategoryProductDao;

    @Override
    public CommonPage<HotCategoryProductResponse> selectList(HotCategoryProductRequest hotCategoryProductRequest) {
        PageHelper.startPage(hotCategoryProductRequest.getPageNum(), hotCategoryProductRequest.getPageSize());
        return CommonPage.restPage(hotCategoryProductDao.selectList(hotCategoryProductRequest));
    }

    @Override
    public Integer insertHotCategoryProduct(Integer hotProductCategoryId, Integer productId, Integer sort) {
        return hotCategoryProductDao.insertHotCategoryProduct(hotProductCategoryId, productId, sort);
    }

    @Override
    public Integer updateSort(Integer categoryProductId, Integer sort) {
        return hotCategoryProductDao.updateSort(categoryProductId, sort);
    }

    @Override
    public Integer removeData(Integer categoryProductId) {
        return hotCategoryProductDao.removeData(categoryProductId);
    }
}
